import { Component, Input, OnInit } from '@angular/core';
import { Router } from '@angular/router';
import { AlertController } from '@ionic/angular';
import { AppGlobalService } from 'src/app/shared/service/app-global.service';
import { PageModalService } from 'src/app/shared/service/page-modal-service';
import { HttpService } from '../../shared/service/http.service';

@Component({
  selector: 'app-info-company-style',
  templateUrl: './info-company-style.component.html',
  styleUrls: ['./info-company-style.component.scss'],
})
export class InfoCompanyStyleComponent implements OnInit {

  @Input() tagData: any;
  appTypeCustom: any;
  constructor(
    public router: Router,
    private httpService: HttpService,
    private appGlobalService: AppGlobalService,
    private pageModalService: PageModalService,
    private alertController: AlertController
  ) {
  }

  ngOnInit() {
    const bodyStyles = window.getComputedStyle(document.body);
    this.appTypeCustom = bodyStyles.getPropertyValue('--appTypeCustom').trim().replace('"', '').replace('"', '');


    // console.log('----->?', this.tagData);
  }

  goPage(link) {
    if (link) {
      link.modalCss = 'video-modal';
      // link.cssClass = 'cssClass';
      this.pageModalService.openPage(link);
    }
  }

  openModalByIcon(link) {
    try {
      if (link) {
        const tmpSessionId = localStorage.getItem('sessionId');
        const pageParams = {
          pageId: link.target,
          params: link.params,
          sessionId: tmpSessionId
        };
        this.appGlobalService.goToForward(pageParams);
      }
    } catch (error) {

    }
  }

}
